import Vue from "vue";
import VueRouter from "vue-router";
import home from "../views/Home";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    component: home,
  },
  {
    path: "/friend",
    component: () => import(/* webpackChunkName: "friend" */ "@/pages/Friend"),
  },
  {
    path: "/goods",
    redirect: "/goods/tips",
    component: () => import(/* webpackChunkName: "goods" */ "@/views/Goods"),
    children: [
      {
        path: "tips",
        component: () =>
          import(/* webpackChunkName: "tips" */ "@/views/Goods/Tips"),
      },
    ],
  },
  {
    name: "detail",
    path: "/detail/:id",
    props: true,
    component: () => import(/* webpackChunkName: "detail" */ "@/views/Detail"),
  },
  {
    path: "/discover",
    name: "discover",
    redirect: "/discover/djradio",
    component: () =>
      import(/* webpackChunkName: "discover" */ "@/pages/Discover"),
    children: [
      {
        path: "toplist",
        component: () =>
          import(/* webpackChunkName: "toplist" */ "@/pages/Discover/Toplist"),
      },
      {
        path: "djradio",
        component: () =>
          import(/* webpackChunkName: "djradio" */ "@/pages/Discover/Djradio"),
      },
    ],
  },
  {
    path: "*",
    component: () => import(/* webpackChunkName: "404" */ "@/pages/Page404"),
  },
  {
    path: "/count",
    component: () => import(/* webpackChunkName */ "@/views/Count"),
  },
  {
    path: "/shoping",
    component: () => import(/* webpackChunkName */ "@/views/Shoping"),
  },
];

const router = new VueRouter({
  //   mode: "history",
  //   mode: "abstract",
  routes,
});

export default router;
